package com.hulk.dryad.manage.boot.logger;

import com.hulk.dryad.manage.boot.launch.DryadLogLevel;
import com.hulk.dryad.manage.boot.launch.LaunchStartedEventListener;
import com.hulk.dryad.manage.framework.knife4j.Knife4jProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *  spring boot props
 *
 * @author hulk
 */
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties({
	DryadRequestLogProperties.class
})
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
@ConditionalOnProperty(name = "enabled", prefix = DryadLogLevel.REQ_LOG_PREFIX,havingValue = "true", matchIfMissing = true)
public class DryadRequestLogAutoConfiguration {

	@Bean
	@ConditionalOnMissingBean
	public RequestLogAspect requestLogAspect(DryadRequestLogProperties dryadRequestLogProperties){
		return  new RequestLogAspect(dryadRequestLogProperties);

	}
}
